<template>
	<view class="bg-white">
		<scroll-view
			:scroll-y="true"
			:upper-threshold="50"
			@scrolltolower="loadMore"
			style="height:100%;"
			v-if="dataSource.length >0"
		>
			<view class="" v-for="(item,i) in dataSource" :key="i">
				<uni-card :title="item.processDefinitionName" extra="额外信息">
					<template v-slot:title>
						<view class="card-title-content">
							<view >
								{{item.processDefinitionName}}
							</view>
						</view>
						<u-divider></u-divider>
					</template>
					<text class="uni-body">
						<view class="">
							<text>标题：{{item.title}};</text>
							<text>申请人：{{item.textMap.procStartUserId$DICT_TEXT_}};</text>
							<text>节点：{{item.name}}</text>
						</view>
					</text>
					<view slot="actions" class="card-actions">
						<view class="card-actions-item" >
							<text class="card-actions-item-text">{{item.procStartTime}}</text>
						</view>
						<view class="card-actions-item" >
							<uni-icons type="pengyouquan" size="18" color="#999"></uni-icons>
							<text class="card-actions-item-text">
								<u-button @click="onClickItem(item)" text="详情" size="small"></u-button>
							</text>
						</view>
					</view>
				</uni-card>
			</view>
			<uni-load-more :status="loadMoreLoading" />
		</scroll-view>
		<view  v-else>
			<u-loading-icon :show="loading"></u-loading-icon>
			<u-empty mode="data" v-if="!loading" />
		</view>
	</view>
</template>

<script>
	import listMixins from '@/mixins/listMixins'
	export default {
		mixins:[listMixins],
		props:{
			processDefinitionName:String
		},
		data() {
			return {
				urlObj:{
					list:'/camunda/task/finished/page'
				},
				queryParam:{},
				disableMixinCreated:true
			}
		},
		watch:{
			processDefinitionName:{
				handler(val){
					this.$set(this.queryParam,'processDefinitionName',val)
				},
				immediate:true
			},
		},
		methods: {
			onClickItem(row){
				this.$emit('click',row)
			},
			onSearch(){
				this.filters = this.filtersPorps
				this.reset()
				this.loadData()
			}
		}
	}
</script>

<style lang="scss" scoped>
	
	.card-actions {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		height: 40px;
		border-top: 1px #eee solid;
	}
	.card-actions-item {
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
	.card-actions-item-text {
		font-size: 12px;
		color: #666;
		margin-left: 5px;
	}
	.card-title-content{
		margin-top: 5px;
		display: flex;
		justify-content:space-between;
	}
</style>